try:
    num1 = int(input('请输入一个数字:'))
    result = 1 / num1
    print((num1))
except Exception as a: #as是别名
    print(a)     #方式一  更加推荐

#
#
# try:
#     num2 = int(input('请输入一个数字:'))
#     result = 1 / num2
#     print((num2))
# except :
#     print('有异常')   #方式二